package com.affectu;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import org.jboss.seam.servlet.SeamListener;

import com.affectu.common.util.LogUtil;

public class StartupListener extends SeamListener implements
		ServletContextListener, HttpSessionListener {

	private LogUtil util = new LogUtil();

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		try {
			super.contextDestroyed(arg0);
			PreJobs.getInstance().stop();
		} catch (Exception ex) {
			util.logException(ex);
		}
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		try {
			super.contextInitialized(sce);
			PreJobs.getInstance().start();
		} catch (Exception ex) {
			util.logException(ex);
		}
	}

	@Override
	public void sessionCreated(HttpSessionEvent event) {
		super.sessionCreated(event);
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent event) {
		super.sessionDestroyed(event);
	}
}
